<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp" %>
<!DOCTYPE html>
<html>
<head>
<title>预约规则列表</title>
 <%@ include file="/WEB-INF/component/commonCSS.jsp" %>
<!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
	<section class="content-header">
		<h1>预约管理</h1>
		<ol class="breadcrumb">
			<li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
			<li class="active">药品招标管理</li>
            <li class="active">预约管理</li>
		</ol>
	</section>

	<section class="content">
		<div class=" box box-success">
			<div class="box-body">
				<div class=" form-inline">
				 <div class="form-group form-group-xs">
                         <label>项目名称：</label>
                         <select class="form-control" style="width:220px;" id="projId" name="projId"></select>
                    </div>
						<button type="button" onclick="likeQuery();" class="btn btn-success btn-sm">查&nbsp;询</button>
				   </div>
			</div>
		</div>
		<table class="jqgrid" id="gridlist"></table>
		<div id="gridpage"></div>
		<%-- <div class=" box box-warning bottongroup">
			<a href="${ctx}/bidSubscribeRecord/toRecordListJsp.html" class="btn btn-default btn-sm">查看预约</a>
		</div> --%>
		<form action="${ctx}/bidSubscribeDetail/toProduceSubscribeAddJsp.html" method="post" id="FormAdd">
			<input type="hidden" id="bidSubscribeIdAdd" name="bidSubscribeId">
			<input type="hidden" id="projNameAdd" name="projName">
		</form>
		<form action="${ctx}/bidSubscribeRecord/toListSuccessJsp.html" method="post" id="FormSuccess">
			<input type="hidden" id="bidSubscribeIdSuc" name="bidSubscribeId">
		</form>
	</section>
   <%@ include file="/WEB-INF/component/commonJS.jsp" %>
    <script src="${ctx}/lib/plugins/daterangepicker/moment.js"></script>
    <script src="${ctx}/lib/plugins/daterangepicker/daterangepicker.js"></script>
	<script type="text/javascript">
		$(function() {
			$("#projId").HNSelect({
	            url: "${pageContext.request.contextPath}/selectController/getDicBidCompany.html", data: { ID: '' }, defaultText: "<option value=''>请选择</option>",
	        });
			$("#gridlist").jqGrid({
								url : "getBidSubscribeData.html",
								mtype : "POST",
								datatype : "json",
								autowidth : true,
								//shrinkToFit:false,
								height : 270,
								colNames : [ '预约id','操作', '项目名称', '预约开始日期','预约结束日期','是否包含周末','上午时间','时间段一单位','时间段一单位上限人数','时间段一已预约人数','时间段一预约上限人数', '下午时间','时间段二单位','时间段二单位上限人数', '时间段二已预约人数','时间段二预约上限人数','状态','备注','更新时间', '更新人' ],
								colModel : [
								            {name : 'bidSubscribeId',width : 100,align : "center",hidden : true,sortable : false},
											{name : 'operate',width : 160,align : "center",sortable : false,
												formatter : function(val, opts,
														rowdata) {
													var str = "<a href=\"javascript:addJsp('"+rowdata.bidSubscribeId+"','"+rowdata.projName+"');\">预约</a>"
													 +"<a href=\"javascript:lookJsp('"+rowdata.bidSubscribeId+"');\">预约查看</a>";
													return str;
											}
											},
											{name : 'projName',width : 210,align : "left",sortable : false},
										    {name : 'subStartDateStr',width : 160,align : "center",sortable : false},
										    {name : 'subEndDateStr',width : 160,align : "center",sortable : false},
										    {name : 'includeWeekend',width : 80,align : "center",hidden : true,sortable : false,
										    	formatter : function(val, opts,
														rowdata) {
													var str = "";
													if (rowdata.includeWeekend == 1) {
														str = "是";
													}
													if (rowdata.includeWeekend == 0) {
														str = "否";
													}
													return str;
											}	
										    },
										    {name : 'processTimeOneStr',width : 120,align : "center",hidden : true,sortable : false,
												formatter : function(val, opts,
														rowdata) {
													return rowdata.processStartTimeOneStr+" - "+rowdata.processEndTimeOneStr;
												}
										    },
										    {name : 'processUnitOne',width : 90,align : "center",hidden : true,sortable : false,
										    	formatter : function(val, opts,
														rowdata) {
													return rowdata.processUnitOne+"分钟"
												}		
										    },
										    {name : 'personCountOne',width : 130,align : "center",hidden : true,sortable : false},
										    {name : 'personNumOne',width : 120,align : "center",hidden : true,sortable : false},
										    {name : 'personCountOne',width : 130,align : "center",hidden : true,sortable : false},
										    {name : 'processStartTimeTwoStr',width : 120,align : "center",hidden : true,sortable : false,
												formatter : function(val, opts,
														rowdata) {
													return rowdata.processStartTimeTwoStr+" - "+rowdata.processEndTimeTwoStr;
												}
										    },
										    {name : 'processUnitTwo',width : 90,align : "center",hidden : true,sortable : false,
										    	formatter : function(val, opts,
														rowdata) {
													return rowdata.processUnitTwo+"分钟"
												}	
										    },
										    {name : 'personCountTwo',width : 130,align : "center",hidden : true,sortable : false},
										    {name : 'personNumTwo',width : 120,align : "center",hidden : true,sortable : false},
										    {name : 'personCountTwo',width : 130,align : "center",hidden : true,sortable : false},
										    {name : 'isEnable',width : 60,align : "center",sortable : false,
												formatter : function(val, opts,
														rowdata) {
													var str = "";
													if (rowdata.isEnable == 1) {
														str = "开启中";
													}
													if (rowdata.isEnable == 0) {
														str = "已关闭";
													}
													return str;
											}
										},
										{name : 'remarks',width : 80,align : "center",hidden : true,sortable : false},
										{name : 'updDatetimeStr',width : 140,align : "center",hidden : true,sortable : false},
										{name : 'updUser',width : 160,align : "center",hidden : true,sortable : false}
										
										],
								rowNum : 20,
								rowList : [ 10, 20, 50,100 ],
								rownumbers : true,
								pager : "#gridpage",
								multiselect : false,
								viewrecords : true,
								caption : "预约项目列表",
								jsonReader : {
									repeatitems : false,
									id : "ids"
								}
							});
			$("#gridlist").jqGrid('navGrid', '#gridpage', {
				add : false,
				edit : false,
				del : false,
				search : false,
				refresh : false
			});

			 $(window).trigger("resize");
		});
		
		function addJsp(id,projName){
			$("#bidSubscribeIdAdd").val(id);
			$("#projNameAdd").val(projName);
			$("#FormAdd").submit();
		}

		
		function lookJsp(id){
			$("#bidSubscribeIdSuc").val(id);
			$("#FormSuccess").submit();
		}
		function likeQuery() {
			var projId = $("#projId").val();
			$("#gridlist").jqGrid('setGridParam',{
				       	    	datatype:'json',
				                postData:{
				                	"projId":projId
				                	},
				                page : 1
			}).trigger("reloadGrid");
		}
		
      
	</script>
</body>
</html>









